package com.cinemate;

import android.app.Activity;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.v4.view.ViewPager;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;

import java.util.ArrayList;
import java.util.List;

public class UpdatesList extends Activity {
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        /*setContentView(R.layout.updateslist);
        HttpUtil util = new HttpUtil();
        SharedPreferences prefs = getSharedPreferences(HomePage.CINEMATE_PREFS, 0);
        String passkey = prefs.getString("passkey", "");
        util.getUpdatesList(passkey);*/

        LayoutInflater inflater = LayoutInflater.from(this);
        List<View> pages = new ArrayList<View>();

        View page = inflater.inflate(R.layout.new_on_site, null);
        pages.add(page);

        page = inflater.inflate(R.layout.new_cinema_films, null);
        pages.add(page);

        page = inflater.inflate(R.layout.updateslist, null);
        pages.add(page);

        page = inflater.inflate(R.layout.watchlist, null);
        pages.add(page);

        SamplePageAdapter pagerAdapter = new SamplePageAdapter(pages);
        ViewPager pager = new ViewPager(this);

        pager.setAdapter(pagerAdapter);
        pager.setCurrentItem(2);

        setContentView(pager);


    }

    @Override
	public boolean onKeyDown(int keyCode, KeyEvent event) {
	    if ((keyCode == KeyEvent.KEYCODE_BACK)) {
	    	moveTaskToBack(true);
	    }
	    return super.onKeyDown(keyCode, event);
	}
}